package hmac

import (
	"fmt"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFinal(t *testing.T) {
	key := make([]byte, 32)
	for i := 0; i < 32; i++ {
		key[i] = byte(i)
	}
	var err error
	p := NewCTX(HMAC_SHA256)
	err = p.Init(key)
	assert.NoError(t, err)

	text := "Hello there! "
	err = p.Update([]byte(text))
	assert.NoError(t, err)

	text += "This is a package for testing hitls hmac go sdk."
	err = p.Update([]byte(text))
	assert.NoError(t, err)

	mac, err := p.Final()
	assert.NoError(t, err)
	fmt.Println(mac)

	p.Free()
}
